<#include "../common/head.ftl">
<!--contaniner-->
<div id="box">

 <!--boxleft-->
 <div class="boxleft">
  <ul>
   <li>
   <#if enterpriseInit[0].ent_status=="0">
   <a href="javascript:void(0)" onclick="correctEmergent()">急招</a>
   <#else>
   <a href="javascript:void(0)" onclick="erroremergentMsg();">急招</a>
   </#if>
   </li>
   <li><a href="${base}/postoffice">发布职位</a></li>
   <li class="currentjob"><a href="${base}/ownjob" style="color:#0089e9;">我的职位</a></li>
  </ul>
 </div>
 <!--/.boxleft-->
 
 <!--boxright-->
 <div class="boxright">
 
<!--studentinfo-->     
<div class="">
  <!--head-->
  <ul id="tab_t" style="width:850px; margin-top:60px;">
    <li class="act" data_flag="01"><a href="#">有效职位</a></li>
    <li data_flag="02"><a href="#">下线职位</a></li>
    <li data_flag="03"><a href="#">待审核职位</a></li>
   <!--  <li><a href="#">已保存职位</a></li>
    <li><a href="#">审核未通过职位</a></li> -->
  </ul>
  <!--/.head-->
  <!--tabcon-->
  <div id="tab_c" style="width:850px;">
    <!--part01-->
    <h1 class="" id="part01">
    
    </h1>
    
    <h1 class="hide" id="part02">

    </h1>
    
    <h1 class="hide" id="part03">
  	
    </h1>
    
  </div>
  <!--/.tabcon-->
  
  <!--清浮动-->
<div style="clear:both"></div>

</div> 
<!--/.studentinfo-->

</div>


<!--清浮动-->
<div style="clear:both"></div>

</div>
<!--/.contaniner-->
    

<!--footer-->
<#include "../common/bottom.ftl">
<!--/.footer--> 


<!--js-->
<!--Tab-->
<script>
window.onload = function(){
  var tab_t = document.getElementById("tab_t");
  var tab_t_li = tab_t.getElementsByTagName("li");
  var tab_c = document.getElementById("tab_c");
  var tab_c_li = tab_c.getElementsByTagName("h1");
	
	<!--alert(tab_c_li.length);-->
    var len = tab_t_li.length;
    var i=0;
    
    for(i=0; i<len; i++){
      tab_t_li[i].index = i;
      tab_t_li[i].onmouseover = function(){
          for(i=0; i<len; i++){
              tab_t_li[i].className = '';
                tab_c_li[i].className = 'hide';
            }
            tab_t_li[this.index].className = 'act';
            tab_c_li[this.index].className = '';
        }
    }
    effective_job_list(0,1);
	effline_job_list(1,1);
	audit_job_list(-1,1);
	
}

	//有效职位
	function effective_job_list(status,pageNO){
		var reqURL="${base}/own_job_list?t="+ new Date().getTime();
		$.post(reqURL,{
			'status' : status,
			'pageNO' : pageNO
		},function(data){
			if(data.result > 0){
				$("#part01").empty();
				$(data.data).each(function(){
					var salary;
					if(this.salary_min==1000 && this.salary_max==20000){
						salary="面议";
					}else if(this.salary_min==20001 && this.salary_max==60000){
						salary="20000以上";
					}else{
						salary = this.salary_min+"-"+this.salary_max;
					}
					if(this.title.length>30){
						tittemp = this.title.substring(0,30);
					}else{
						tittemp = this.title;
					}
					$div = $("<div class='jobinfo' style='margin-top:20px;'>"
					+"<div class='jobinfo_l'><p class='jobrenew pt20'><a href='${base}/ownjob/j_"+this.id+".html?resume="+this.resume_num+"&time="+new Date().getTime()+"'>"+tittemp+"</a><br>有效期至：<em>"+this.over_time+"</em></p>"+
					"<p class='pt30'>"+this.job_type+"</p>"+
					"<p>"+this.work_type+"&nbsp;&nbsp;"+salary+"</p></div><div class='jobinfo_r'><span class='numfother'><em style='color:#000;'>"+this.resume_num+"</em>份</span>"+
					"<span class='obtainother'>收到简历</span></div></div>");
					$("#part01").append($div);
				})
				if(data.total>20){
					$("#part01").append("<div id='Pagination01' class='pagination'></div><br style=''clear:both;'/>");
					$("#Pagination01").pagination(data.total,20,pageNO-1, {
						num_edge_entries: 2,
						num_display_entries: 5,
						callback: effectivePage  //回调函数
					});
				}
			}else{
				$("#part01").append("<p class='nodata'>暂无有效职位</p>");
			}
		});
	}
	function effectivePage(page_id){
		page_id = page_id+1;
		effective_job_list(0,page_id);
	}
	
	//下线
	function effline_job_list(status,pageNO){
		var reqURL="${base}/own_job_list?t="+ new Date().getTime();
		$.post(reqURL,{
			'status' : status,
			'pageNO' : pageNO
		},function(data){
			if(data.result > 0){
				$("#part02").empty();
				$(data.data).each(function(){
					var salary;
					if(this.salary_min==1000 && this.salary_max==20000){
						salary="面议";
					}else if(this.salary_min==20001 && this.salary_max==60000){
						salary="20000以上";
					}else{
						salary = this.salary_min+"-"+this.salary_max;
					}
					if(this.title.length>30){
						tittemp = this.title.substring(0,30);
					}else{
						tittemp = this.title;
					}
					$div = $("<div class='jobinfo' style='margin-top:20px;'>"
							+"<div class='jobinfo_l'>"
							+"<p class='jobrenew pt20'><a href='${base}/ownjob/j_"+this.id+".html?resume="+this.resume_num+"&time="+new Date().getTime()+"'>"+tittemp+"</a><br>下线时间：<em>"+this.refresh_time+"</em></p>"
							+"<p class='pt30'>"+this.job_type+"</p>"
							+"<p>"+this.work_type+"    &nbsp;&nbsp;"+salary+"</p>"
							+"</div>"
							+"<div class='jobinfo_r'>"
							+"<span class='numfother'><em style='color:#000;'>"+this.resume_num+"</em>份</span>"
							+"<span class='obtainother'>收到简历</span>"
							+"</div>"
							+"</div>");
					$("#part02").append($div);
				})
				if(data.total>20){
					$("#part02").append("<div id='Pagination02' class='pagination'></div><br style=''clear:both;'/>");
					$("#Pagination02").pagination(data.total,20,pageNO-1, {
						num_edge_entries: 2,
						num_display_entries: 5,
						callback: efflineivePage  //回调函数
					});
				}
			}else{
				$("#part02").append("<p class='nodata'>暂无下线职位</p>");
			}
		});
	}
	function efflineivePage(page_id){
		page_id = page_id+1;
		effline_job_list(0,page_id);
	}
	
	//审核中
	function audit_job_list(status,pageNO){
		var reqURL="${base}/own_job_list?t="+ new Date().getTime();
		$.post(reqURL,{
			'status' : status,
			'pageNO' : pageNO
		},function(data){
			if(data.result > 0){
				$("#part03").empty();
				$(data.data).each(function(){
					var salary;
					if(this.salary_min==1000 && this.salary_max==20000){
						salary="面议";
					}else if(this.salary_min==20001 && this.salary_max==60000){
						salary="20000以上";
					}else{
						salary = this.salary_min+"-"+this.salary_max;
					}
					if(this.title.length>30){
						tittemp = this.title.substring(0,30);
					}else{
						tittemp = this.title;
					}
					var imgPath="";
					if(this.status=="审核中"){
						imgPath="${base}/resources/images/56567891_03.png";
					}else if(this.status=="已保存"){
						imgPath="${base}/resources/images/8599712_03.png";
					}else{
						imgPath="${base}/resources/images/56656kokokppp_03.png";
					}
					$div = $("<div class='jobinfo' style='width:848px; height:250px; margin-top:20px;'>"
						      +"<div class='jobinfo_l'>"
						      +"<span class='jobtips'><img src='"+imgPath+"' /></span>"
						      +"<p class='jobrenew pt20' style='padding-top:80px;'><a href='${base}/ownjob/j_"+this.id+".html?resume="+this.resume_num+"&time="+new Date().getTime()+"'>"+tittemp+"</a><br>提交时间：<em>"+this.refresh_time+"</em></p>"
						      +"<p class='pt30'>"+this.job_type+"</p>"
						      +"<p>"+this.work_type+"    &nbsp;&nbsp;"+salary+"</p>"
						      +"</div>"
						      +"<div class='jobinfo_r'>"
						      +"<span class='numfother' style=' margin-top:80px;'><em style='color:#000;'>"+this.resume_num+"</em>份</span>"
						      +"<span class='obtainother'>收到简历</span>"
						      +"</div></div>");
					$("#part03").append($div);
				})
				if(data.total>20){
					$("#part03").append("<div id='Pagination03' class='pagination'></div><br style=''clear:both;'/>");
					$("#Pagination03").pagination(data.total,20,pageNO-1, {
						num_edge_entries: 2,
						num_display_entries: 5,
						callback: auditPage  //回调函数
					});
				}
			}else{
				$("#part03").append("<p class='nodata'>暂无审核中职位</p>");
			}
		});
	}
	function auditPage(page_id){
		page_id = page_id+1;
		audit_job_list(-1,page_id);
	}
	
	function erroremergentMsg(){
		layer.alert("企业未设置急招职位", {icon: 7,skin: 'layer-ext-moon'});
	}
	function correctEmergent(){
		var reqURL="${base}/checkEme";
		$.post(reqURL,function(data){
			if(data.success){
				location.href="${base}/emergent";
			}else{
				layer.alert("企业未设置急招职位", {icon: 7,skin: 'layer-ext-moon'});
			}
		});
	}
</script>
<!--/.Tab-->
<!--/.js--> 

</body>
</html>